package rhc.taskSchedule.taskSchedule.task.manage;

import rhc.taskSchedule.commander.TaskScheduleCommanderExecute;
import rhc.taskSchedule.taskSchedule.task.TaskExecute;
import rhc.taskSchedule.taskSignalCall.CallCustom;

public class TaskExecuteManageImpl extends BasicTaskExecuteManageImpl {

	public TaskExecuteManageImpl(TaskScheduleCommanderExecute taskScheduleCommanderExecute) throws Exception {
		super(taskScheduleCommanderExecute);
	}

	@Override
	public void run(String runningId) throws Exception {
		CallCustom callCustom=this.getCallCustomByRunningId(runningId);
		if(null != callCustom){
			callCustom.run();
		}
		TaskExecute taskExecute=this.getTaskExecuteByRunningId(runningId);
		taskExecute.run();
	}

	@Override
	public void stop(String runningId) throws Exception {
		TaskExecute taskExecute=this.getTaskExecuteByRunningId(runningId);
		taskExecute.stop();
	}

	@Override
	public void pause(String runningId) throws Exception {
		TaskExecute taskExecute=this.getTaskExecuteByRunningId(runningId);
		taskExecute.pause();
	}

	@Override
	public void regain(String runningId) throws Exception {
		TaskExecute taskExecute=this.getTaskExecuteByRunningId(runningId);
		taskExecute.regain();
	}

}
